﻿using Microsoft.AspNetCore.Mvc;
using PoemGame.Domain.Services.Duishi;
using PoemGameWebApiService.Shared;
using PoemService.Shared;

namespace PoemGameJielongWebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class DuishiController : ControllerBase
    {
        private readonly IPoemService poemService;
        private readonly DuishiCheckAnswerService duishiCheckAnswerService;
        private readonly DuishiCheckGameConditionService duishiCheckGameConditionService;

        public DuishiController(IPoemService poemService,
            DuishiCheckAnswerService duishiCheckAnswerService,
            DuishiCheckGameConditionService duishiCheckGameConditionService)
        {
            this.poemService = poemService;
            this.duishiCheckAnswerService = duishiCheckAnswerService;
            this.duishiCheckGameConditionService = duishiCheckGameConditionService;
        }

        [HttpPost("CheckAnswer")]
        public async Task<bool> CheckAnswer(CheckAnswerServiceDto dto)
        {
            return await duishiCheckAnswerService.CheckAnswer(dto.Input, dto.Answer);
        }

        [HttpPost("CheckCondition")]
        public async Task<bool> CheckCondition(CheckConditionServiceDto dto)
        {
            return await duishiCheckGameConditionService.CheckGameCondition(dto.Condition);
        }
    }
}
